package com.pine.dcts.common;

import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;

/**
 * @version V1.0
 * @author:xuwhe
 * @Title: ServiceException
 * @Package: com.cecdsc.platform.common.exception
 * @Description: TOTO
 * @date 2019/9/25 10:51
 **/
@Setter
@Getter
public class DctsException extends RuntimeException {

    protected Integer code;
    protected String message;

    private Object data;

    public DctsException(Integer code) {
        this.code = code;
    }

    public DctsException(String message) {
        this.message = message;
    }

    public DctsException(String message, Object... args) {
        this.message = String.format(message,args);
    }

    public DctsException(Integer code, String message) {
        this.code = code == null ? HttpStatus.INTERNAL_SERVER_ERROR.value() : code;
        this.message = message;
    }

    public DctsException(String message, Throwable cause) {
        super(message, cause);
        this.message = message;
    }

    public DctsException(Integer code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;

    }
}